public class CopyFile implements Runnable{

	private String data;
	private java.io.InputStream input;
	private String copyTo;
	public CopyFile(String d,java.io.InputStream in,String copy){
		this.data=d;
		this.input=in;
		this.copyTo=copy;
	}
	public void run(){
		try{ 
			System.out.println("file &&&&&&&&&&&&&&&&");
			java.io.File file = new java.io.File(data);
			String fileName = file.getName();
			java.io.File filecopy = new java.io.File(copyTo);
			if(!filecopy.exists()){
				filecopy.mkdir();
			}
			java.io.FileOutputStream outFile = new java.io.FileOutputStream(copyTo+"//"+fileName);
			//
			java.io.DataInputStream inFile = new java.io.DataInputStream(input);
			int i;
			while((i=inFile.read())!=-1){
				outFile.write(i);
				System.out.println(i);
			}
			//
			outFile.close();

		}catch(Exception e){
			
			e.printStackTrace();
			
		}
	}
}
